/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package transport;

import java.util.LinkedList;

/**
 *
 * @author Miguel
 */
public class Central {
    Camion[] c;
    private int dechargement;
    private boolean occuper;
    private LinkedList<String> fil;
    private LinkedList<String> filCamion;
    private boolean ready;
    
    public Central(){
        dechargement = 2;
        occuper = false;
        fil = new LinkedList<>();
    }
    
    public boolean isOccuper(){
        return occuper;
    }
    public void liberPlace(){
        occuper = false;
    }
    
    public int decharge(){
        if(occuper){return -1;}
        else{
            occuper = true;
            return dechargement;
        }
    }
    
    public void addAttent(String nom){
        fil.addLast(nom);
    }
    public boolean isFirstAttent(String nom){
        boolean temp = fil.isEmpty() ? true : fil.element().equals(nom);
        if(temp && !fil.isEmpty()){
            fil.removeFirst();
        }
        return temp;
    }
}
